Conversation
Refresh file listings on breadcrumb navigation after bitstream upload
There was a problem hiding this comment.
Pull request overview
Fixes stale file listings after a bitstream upload when returning to the item page via breadcrumbs by forcing fresh item/bitstream-related data resolution instead of reusing cached metadatabitstreams results.
Changes:
- Refresh preview/CLARIN file list components when their
item/itemHandleinputs change (and manage subscriptions). - Adjust item resolution to allow re-requesting when cached responses become stale.
- Mark relevant cached requests as stale after a successful bitstream upload, and extend unit tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/app/item-page/simple/field-components/preview-section/preview-section.component.ts | Refresh bitstream listing when item input changes; adds subscription cleanup. |
| src/app/item-page/item.resolver.ts | Enables reRequestOnStale when resolving items by ID. |
| src/app/item-page/clarin-files-section/clarin-files-section.component.ts | Refresh CLARIN file list when item/itemHandle inputs change; adds subscription cleanup. |
| src/app/item-page/bitstreams/upload/upload-bitstream.component.ts | Marks multiple cached requests stale after upload to force fresh data on navigation back. |
| src/app/item-page/bitstreams/upload/upload-bitstream.component.spec.ts | Extends tests to account for additional cache-staling behavior. |
Move refresh logic to ngOnChanges
Set related requests stale instead of removing cache
Use setStaleByHrefSubstring for metadatabitstreams cache
Add null checks for nested RemoteData access
kosarko
left a comment
There was a problem hiding this comment.
@amadulhaxxani While this seems to refresh correctly after adding a bitstream, a similar issues is there when I remove the bitstream (shouldn't be much of an issue in production, but if it is a quick fix...).
Also see the two comments
Replace uses of this.bitstream with the local bitstream observable in edit-bitstream-page to reference the correct stream when computing image/IIIF/enabled flags. After removing bitstreams, clear relevant caches in item-bitstreams: mark bundle bitstreams hrefs stale and invalidate metadatabitstreams search-by-handle (both encoded and raw variants) so file lists, previews and CLARIN file sections refresh correctly.
- PreviewSectionComponent: store and unsubscribe configService subscription in ngOnDestroy to prevent memory leak - ItemBitstreamsComponent: add hasValue() null guard before bundles.forEach() for idiomatic style Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@amadulhaxxani can you check 36b3fc6 |
|
@kosarko its fine but the pipeline failed, I will fix the issue and will push again |
|
Backport branch created but failed to create PR. Please create the PR manually: Or via GitHub CLI: gh pr create --repo dataquest-dev/dspace-angular --base dtq-dev --head ufal:backport-112-to-dtq-dev --title "[Port dtq-dev] Refresh file listings on breadcrumb navigation after bitstream upload" --body "Port of #112 by @amadulhaxxani to `dtq-dev`."(see action log for full error response) |
Refresh file listings on breadcrumb navigation after bitstream upload
Problem description
After uploading a bitstream to an item, the file list component would not refresh when navigating back to the item page via breadcrumb. The uploaded file would not appear in the item view without a manual page refresh, because stale cached bitstream data was being returned from the metadatabitstreams byHandle endpoint.
Copilot review